package com.thiswhyme.redis.subscribe;

import lombok.extern.slf4j.Slf4j;
import org.springframework.data.redis.connection.Message;

/**
 * @description: 消息监听器抽象类
 * @author: thiswhyme
 * @date: 2020/12/9
 */
@Slf4j
public abstract class AbstractRedisSubscriber implements RedisSubscriber {

    @Override
    public void onMessage(Message message, byte[] pattern) {
        log.debug("【{}通道】监听到消息，内容：{}", getChannelName(), message);
        doBizOperation(message, pattern);
        log.debug("【{}通道】消息处理完成", getChannelName());
    }

    public abstract void doBizOperation(Message message, byte[] pattern);
}
